package com.example.myapplication;

import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

public class ButtonDisabled extends AppCompatActivity implements View.OnClickListener {
    Button btnDisabled;
    Button btnEnabled;
    Button btnTest;
    TextView text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_button_disabled);


         btnDisabled = findViewById(R.id.disabled);
         btnEnabled = findViewById(R.id.enabled);
         btnTest = findViewById(R.id.btn);
         text = findViewById(R.id.text_view);

        btnDisabled.setOnClickListener(this);
        btnEnabled.setOnClickListener(this);

    }

    @Override
    public void onClick(View view) {
        int currentEventId = view.getId();
        boolean isDisabled = R.id.disabled == currentEventId;
        boolean isEnabled = R.id.enabled == currentEventId;

        Log.d("zhoutao", Boolean.toString(isEnabled));

        if(isDisabled) {
            btnTest.setTextColor(Color.GRAY);
            btnTest.setEnabled(false);
        }else if(isEnabled){
            btnTest.setEnabled(true);
            btnTest.setTextColor(Color.WHITE);
        }
    }
}